Use the Windows-proprietary MoveFileEx to rename files in KML writer for
authorrobertl <robertl>
Fri, 10 Nov 2006 01:39:05 +0000 (01:39 +0000)
committerrobertl <robertl>
Fri, 10 Nov 2006 01:39:05 +0000 (01:39 +0000)
atomicity.

kml.c

diff --git a/kml.c b/kml.c
index cd92713a0834076c8b673d5065e50e665904257c..8178a3f9582773bc67a8a3dcdbbc081193945fca 100644 (file)
--- a/kml.c
+++ b/kml.c
@@ -288,15 +288,8 @@ kml_wr_deinit(void)
 
        if (posnfilenametmp) {
 #if __WIN32__
-               /*
-                * This is gross.
-                * Windows does not offer an atomic rename; we must
-                * explictly remove the destination here which exposes
-                * a window where a polled reader of this file could find
-                * the file to be missing.  Windows readers will simply
-                * have to retry on this case.
-                */
-               _unlink(posnfilename);
+               MoveFileEx(posnfilenametmp, posnfilename,
+               MOVEFILE_REPLACE_EXISTING);
 #endif
                rename(posnfilenametmp, posnfilename);
                xfree(posnfilenametmp);